package com.solution.admin.product.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.solution.admin.product.dao.ProductSpecRelaDao;
import com.solution.admin.product.entity.ProductSpecRelaEntity;
import com.solution.common.dao.impl.BaseDaoImpl;

/**
 * 商品规格关联DAO实现
 * @author xu_cc
 * @date 2017-08-31 23:46:57
 */
@Repository
public class ProductSpecRelaDaoImpl extends BaseDaoImpl<ProductSpecRelaEntity> implements ProductSpecRelaDao {

    /**
     * 保存商品规格关联信息
     * @param ebProductSpecRelaEntity
     * @return
     * @author xu_cc
     * @date 2017-08-31 23:46:57
     */
    @Override
    public long saveProductSpecRela(ProductSpecRelaEntity ebProductSpecRelaEntity) {
        return super.insert(ebProductSpecRelaEntity);
    }

    /**
     * 删除商品规格关联
     * @param ebProductSpecRelaId
     * @return
     * @author xu_cc
     * @date 2017-08-31 23:46:57
     */
    public int deleteProductSpecRelaById( Long productId) {
        return super.deleteById(productId);
    }
    
    /**
     * 根据条件查询商品规格关联
     * @param param
     * @return
     * @author xu_cc
     * @date 2017-08-31 23:46:57
     */
    @Override
    public List<ProductSpecRelaEntity> listProductSpecRela( Map<String, Object> param) {
        return super.listBy(param);
    }
    
    /**
     * 查询商品列表中第个商品的规格项及价格
     * @param productCodeList
     * @return
     * @author lilp
     */
	public List<ProductSpecRelaEntity> listProductSpecRelaForIndex(List<Long> productIdList){
		return getSessionTemplate().selectList(getStatement("listProductSpecRelaForIndex"), productIdList);
	}
}
